package cn.kmsoft.stgeometry.landm;

import java.io.Serializable;

/**
 * @author : cqwensten
 * @description : todo
 * @email : cqwensten@163.com
 * @date : 2023/1/9
 */
public class StgeoField implements Serializable,Comparable{
    private String name;
    private String type;
    private String alias;
    private int order;

    public StgeoField(){}
    public StgeoField(int order){
        this.order= order;
    }

    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }

    public String getType() {
        return type;
    }
    public void setType(String type) {
        this.type = type;
    }

    public String getAlias() {
        return alias;
    }
    public void setAlias(String alias) {
        this.alias = alias;
    }

    public int getOrder() {
        return order;
    }
    public void setOrder(int order) {
        this.order = order;
    }

    @Override
    public int compareTo(Object o) {
        StgeoField sta2 = (StgeoField)o;
        int ord= this.order-sta2.getOrder();
        if( ord ==0 ) {
            return compare(this.name, sta2.getName());
        }
        return ord;
    }

    public int compare(String o1, String o2) {
        return o2.compareTo(o1);
    }
}
